class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: A = None
        self.z: C = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.x: C = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: E = None
        self.txt = txt

b = A("b")
a = B("a")
h = C("h")
f = D("f")
j = E("j")
e = F("e")
c = D("c")
l = A("l")

b.q = a
a.z = c
a.o = h
h.o = j
h.t = j
f.x = j
f.v = b
f.o = b
f.z = h
j.q = l
j.y = c
j.x = h
j.r = a
e.u = h
e.v = j
c.x = j
c.v = l
c.o = l
c.z = h
l.q = a
assert f.x.r.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: A = None
        self.z: C = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.x: C = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: E = None
        self.txt = txt

b = A("b")
a = B("a")
h = C("h")
f = D("f")
j = E("j")
e = F("e")
c = D("c")
l = A("l")

b.q = a
a.z = c
a.o = h
h.o = j
h.t = j
f.x = j
f.v = b
f.o = b
f.z = h
j.q = l
j.y = c
j.x = h
j.r = a
e.u = h
e.v = j
c.x = j
c.v = l
c.o = l
c.z = h
l.q = a
assert f.x.r.o.t.txt == "j"