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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: C = None
        self.r: A = None
        self.s: C = None
        self.txt = txt

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

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

f.p = k
f.y = d
f.q = l
f.z = l
k.s = g
k.z = l
k.u = c
j.v = k
j.y = d
j.s = d
j.r = f
g.z = j
g.y = l
l.p = k
l.y = d
l.q = f
l.z = f
d.v = k
d.y = j
d.s = j
d.r = l
c.z = d
c.y = l
assert f.q.y.y.r.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: C = None
        self.q: A = None
        self.z: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: C = None
        self.r: A = None
        self.s: C = None
        self.txt = txt

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

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

f.p = k
f.y = d
f.q = l
f.z = l
k.s = g
k.z = l
k.u = c
j.v = k
j.y = d
j.s = d
j.r = f
g.z = j
g.y = l
l.p = k
l.y = d
l.q = f
l.z = f
d.v = k
d.y = j
d.s = j
d.r = l
c.z = d
c.y = l
assert f.q.y.y.r.y.r.txt == "l"