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

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

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

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

j = A("j")
k = B("k")
g = C("g")
l = D("l")
d = B("d")
a = C("a")
n = A("n")
c = D("c")

j.t = c
j.o = c
j.p = d
k.q = l
k.x = d
k.y = c
k.p = n
g.u = a
g.t = d
l.q = c
l.r = c
d.q = c
d.y = c
d.x = k
d.p = n
a.u = g
a.t = k
n.t = l
n.o = c
n.p = d
c.q = l
c.r = l
assert c.q.r.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: D = None
        self.p: B = None
        self.txt = txt

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

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

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

j = A("j")
k = B("k")
g = C("g")
l = D("l")
d = B("d")
a = C("a")
n = A("n")
c = D("c")

j.t = c
j.o = c
j.p = d
k.q = l
k.x = d
k.y = c
k.p = n
g.u = a
g.t = d
l.q = c
l.r = c
d.q = c
d.y = c
d.x = k
d.p = n
a.u = g
a.t = k
n.t = l
n.o = c
n.p = d
c.q = l
c.r = l
assert c.q.r.q.q.txt == "c"