class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: A = None
        self.t: E = None
        self.q: F = None
        self.w: D = None
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: C = None
        self.y: B = None
        self.v: B = None
        self.z: A = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: A = None
        self.y: A = None
        self.txt = txt

k = A("k")
j = B("j")
i = C("i")
l = D("l")
h = E("h")
a = F("a")
b = B("b")

k.y = h
j.y = h
j.t = h
j.p = k
j.q = a
j.r = a
j.w = l
i.r = j
l.o = j
l.r = i
l.t = i
l.y = b
l.v = b
l.z = k
h.p = a
a.x = l
a.o = k
a.y = k
b.y = h
b.t = h
b.p = k
b.q = a
b.r = a
b.w = l
assert a.x.z.y.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: A = None
        self.t: E = None
        self.q: F = None
        self.w: D = None
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: C = None
        self.y: B = None
        self.v: B = None
        self.z: A = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: A = None
        self.y: A = None
        self.txt = txt

k = A("k")
j = B("j")
i = C("i")
l = D("l")
h = E("h")
a = F("a")
b = B("b")

k.y = h
j.y = h
j.t = h
j.p = k
j.q = a
j.r = a
j.w = l
i.r = j
l.o = j
l.r = i
l.t = i
l.y = b
l.v = b
l.z = k
h.p = a
a.x = l
a.o = k
a.y = k
b.y = h
b.t = h
b.p = k
b.q = a
b.r = a
b.w = l
assert a.x.z.y.p.x.txt == "l"