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

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

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

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

f = A("f")
e = B("e")
l = C("l")
k = D("k")
j = A("j")
a = D("a")
h = D("h")
b = C("b")

f.x = b
e.q = b
l.v = j
l.s = j
l.r = e
l.t = a
k.x = f
k.p = e
j.x = l
a.x = f
a.p = e
h.x = j
h.p = e
b.v = j
b.s = j
b.r = e
b.t = h
assert h.x.x.v.x.t.x.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

f = A("f")
e = B("e")
l = C("l")
k = D("k")
j = A("j")
a = D("a")
h = D("h")
b = C("b")

f.x = b
e.q = b
l.v = j
l.s = j
l.r = e
l.t = a
k.x = f
k.p = e
j.x = l
a.x = f
a.p = e
h.x = j
h.p = e
b.v = j
b.s = j
b.r = e
b.t = h
assert h.x.x.v.x.t.x.x.r.txt == "e"