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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: F = None
        self.o: A = None
        self.x: A = None
        self.s: B = None
        self.r: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: A = None
        self.x: C = None
        self.y: A = None
        self.r: A = None
        self.txt = txt

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

j.p = g
a.o = c
k.p = h
k.u = h
g.u = h
c.v = g
c.w = h
c.o = j
c.x = j
c.r = j
c.s = a
h.z = k
h.x = k
h.o = j
h.y = j
h.r = j
assert c.w.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: F = None
        self.o: A = None
        self.x: A = None
        self.s: B = None
        self.r: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: A = None
        self.x: C = None
        self.y: A = None
        self.r: A = None
        self.txt = txt

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

j.p = g
a.o = c
k.p = h
k.u = h
g.u = h
c.v = g
c.w = h
c.o = j
c.x = j
c.r = j
c.s = a
h.z = k
h.x = k
h.o = j
h.y = j
h.r = j
assert c.w.x.u.x.txt == "k"