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

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

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

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

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

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

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

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

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

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

g.r = m
g.u = f
g.t = k
m.y = j
m.p = k
b.o = c
b.s = g
l.v = c
l.y = j
l.o = m
l.s = k
k.r = m
k.u = f
k.t = g
c.v = j
c.y = l
c.o = m
c.s = g
j.v = l
j.y = l
j.o = m
j.s = g
f.o = j
f.s = g
assert k.r.y.v.y.v.o.p.u.txt == "f"