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

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

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

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

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