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

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

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

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

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

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

b = A("b")
i = B("i")
m = C("m")
k = D("k")
g = E("g")
j = F("j")
c = D("c")

b.y = j
i.z = m
m.p = g
m.v = j
k.r = j
k.q = c
g.o = b
g.z = j
j.y = m
j.x = m
j.o = g
j.q = c
j.s = b
c.r = j
c.q = k
assert g.z.o.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

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

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

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

b = A("b")
i = B("i")
m = C("m")
k = D("k")
g = E("g")
j = F("j")
c = D("c")

b.y = j
i.z = m
m.p = g
m.v = j
k.r = j
k.q = c
g.o = b
g.z = j
j.y = m
j.x = m
j.o = g
j.q = c
j.s = b
c.r = j
c.q = k
assert g.z.o.o.y.txt == "j"