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

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

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

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

c = A("c")
j = B("j")
i = C("i")
g = D("g")
a = D("a")
b = C("b")
e = B("e")
l = C("l")
d = C("d")

c.y = e
c.p = j
c.z = j
j.u = e
j.y = e
j.v = a
i.r = l
i.o = c
g.r = a
g.q = c
a.r = g
a.q = c
b.r = l
b.o = c
e.u = j
e.y = j
e.v = g
l.r = i
l.o = c
d.r = i
d.o = c
assert l.o.y.v.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: B = None
        self.z: B = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
i = C("i")
g = D("g")
a = D("a")
b = C("b")
e = B("e")
l = C("l")
d = C("d")

c.y = e
c.p = j
c.z = j
j.u = e
j.y = e
j.v = a
i.r = l
i.o = c
g.r = a
g.q = c
a.r = g
a.q = c
b.r = l
b.o = c
e.u = j
e.y = j
e.v = g
l.r = i
l.o = c
d.r = i
d.o = c
assert l.o.y.v.r.r.r.r.r.txt == "a"