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

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

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

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

c = A("c")
e = B("e")
m = C("m")
j = D("j")
h = B("h")
l = B("l")

c.x = e
c.o = j
c.y = m
c.r = m
e.u = j
e.z = j
e.s = m
e.t = m
m.r = h
m.x = h
m.o = c
j.x = e
j.u = h
h.u = j
h.z = j
h.s = m
h.t = m
l.u = j
l.z = j
l.s = m
l.t = m
assert e.u.x.z.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: D = None
        self.y: C = None
        self.r: C = None
        self.txt = txt

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

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

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

c = A("c")
e = B("e")
m = C("m")
j = D("j")
h = B("h")
l = B("l")

c.x = e
c.o = j
c.y = m
c.r = m
e.u = j
e.z = j
e.s = m
e.t = m
m.r = h
m.x = h
m.o = c
j.x = e
j.u = h
h.u = j
h.z = j
h.s = m
h.t = m
l.u = j
l.z = j
l.s = m
l.t = m
assert e.u.x.z.u.z.txt == "j"