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

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

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

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

j = A("j")
b = B("b")
k = C("k")
a = D("a")
c = B("c")
f = B("f")
l = D("l")
n = C("n")

j.y = k
j.p = n
b.q = j
b.y = c
b.o = l
b.u = f
k.u = f
k.z = n
a.s = j
a.p = n
a.o = f
c.q = j
c.y = b
c.o = l
c.u = f
f.q = j
f.y = c
f.o = l
f.u = b
l.s = j
l.p = k
l.o = f
n.u = b
n.z = k
assert l.s.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: C = None
        self.txt = txt

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

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

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

j = A("j")
b = B("b")
k = C("k")
a = D("a")
c = B("c")
f = B("f")
l = D("l")
n = C("n")

j.y = k
j.p = n
b.q = j
b.y = c
b.o = l
b.u = f
k.u = f
k.z = n
a.s = j
a.p = n
a.o = f
c.q = j
c.y = b
c.o = l
c.u = f
f.q = j
f.y = c
f.o = l
f.u = b
l.s = j
l.p = k
l.o = f
n.u = b
n.z = k
assert l.s.y.u.y.txt == "c"