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

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

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

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

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

h.y = e
h.p = j
h.u = j
h.q = j
b.q = h
b.v = h
b.o = c
j.p = h
j.r = h
j.q = h
j.t = k
e.r = j
m.q = h
m.v = h
m.o = b
k.r = j
c.q = h
c.v = h
c.o = m
assert m.o.q.y.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: C = None
        self.u: C = None
        self.q: C = None
        self.txt = txt

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

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

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

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

h.y = e
h.p = j
h.u = j
h.q = j
b.q = h
b.v = h
b.o = c
j.p = h
j.r = h
j.q = h
j.t = k
e.r = j
m.q = h
m.v = h
m.o = b
k.r = j
c.q = h
c.v = h
c.o = m
assert m.o.q.y.r.t.txt == "k"