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

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

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

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

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

c = A("c")
g = B("g")
j = C("j")
n = D("n")
m = E("m")
f = B("f")

c.z = f
c.o = g
g.x = f
g.o = j
j.y = n
j.p = c
j.t = m
n.u = j
n.w = j
n.p = c
m.u = c
m.v = j
f.x = g
f.o = j
assert g.x.o.t.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: B = None
        self.txt = txt

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

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

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

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

c = A("c")
g = B("g")
j = C("j")
n = D("n")
m = E("m")
f = B("f")

c.z = f
c.o = g
g.x = f
g.o = j
j.y = n
j.p = c
j.t = m
n.u = j
n.w = j
n.p = c
m.u = c
m.v = j
f.x = g
f.o = j
assert g.x.o.t.u.z.txt == "f"