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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: B = None
        self.y: C = None
        self.r: B = None
        self.s: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: B = None
        self.txt = txt

a = A("a")
j = B("j")
c = C("c")
g = D("g")
b = E("b")
h = F("h")

a.y = h
a.o = c
a.q = g
j.o = c
j.s = b
j.r = b
j.z = g
c.o = j
c.x = h
g.o = b
b.z = h
b.w = j
b.r = j
b.y = c
b.s = c
h.t = a
h.z = j
assert g.o.z.z.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.o: C = None
        self.q: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: B = None
        self.y: C = None
        self.r: B = None
        self.s: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: B = None
        self.txt = txt

a = A("a")
j = B("j")
c = C("c")
g = D("g")
b = E("b")
h = F("h")

a.y = h
a.o = c
a.q = g
j.o = c
j.s = b
j.r = b
j.z = g
c.o = j
c.x = h
g.o = b
b.z = h
b.w = j
b.r = j
b.y = c
b.s = c
h.t = a
h.z = j
assert g.o.z.z.o.o.txt == "j"