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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

n = A("n")
j = B("j")
c = C("c")
m = D("m")
h = E("h")
i = F("i")
d = B("d")

n.u = m
j.p = h
c.v = n
m.w = n
m.y = i
m.z = i
m.r = h
m.s = d
h.t = m
h.x = m
i.w = m
i.o = m
i.t = j
i.r = h
d.p = h
assert j.p.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

n = A("n")
j = B("j")
c = C("c")
m = D("m")
h = E("h")
i = F("i")
d = B("d")

n.u = m
j.p = h
c.v = n
m.w = n
m.y = i
m.z = i
m.r = h
m.s = d
h.t = m
h.x = m
i.w = m
i.o = m
i.t = j
i.r = h
d.p = h
assert j.p.t.z.txt == "i"