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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: E = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: A = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: D = None
        self.x: E = None
        self.t: A = None
        self.q: C = None
        self.txt = txt

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

f.q = e
f.p = e
f.o = a
h.x = a
h.y = e
h.q = c
h.o = f
c.r = j
a.r = j
a.u = j
a.q = h
j.u = a
j.z = a
j.s = f
e.p = c
e.q = c
e.s = a
e.x = j
e.t = f
assert c.r.s.q.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.o: D = None
        self.p: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: E = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: A = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: D = None
        self.x: E = None
        self.t: A = None
        self.q: C = None
        self.txt = txt

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

f.q = e
f.p = e
f.o = a
h.x = a
h.y = e
h.q = c
h.o = f
c.r = j
a.r = j
a.u = j
a.q = h
j.u = a
j.z = a
j.s = f
e.p = c
e.q = c
e.s = a
e.x = j
e.t = f
assert c.r.s.q.x.s.txt == "f"