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

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

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

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

f = A("f")
k = B("k")
b = C("b")
g = D("g")
i = C("i")
h = A("h")
c = B("c")

f.u = c
k.s = b
k.v = b
k.u = g
k.p = c
b.t = i
b.v = f
b.u = c
g.q = f
g.y = k
g.v = b
i.t = b
i.v = f
i.u = k
h.u = k
c.s = b
c.v = b
c.u = g
c.p = k
assert c.p.v.u.p.u.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

f = A("f")
k = B("k")
b = C("b")
g = D("g")
i = C("i")
h = A("h")
c = B("c")

f.u = c
k.s = b
k.v = b
k.u = g
k.p = c
b.t = i
b.v = f
b.u = c
g.q = f
g.y = k
g.v = b
i.t = b
i.v = f
i.u = k
h.u = k
c.s = b
c.v = b
c.u = g
c.p = k
assert c.p.v.u.p.u.v.u.txt == "c"