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

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.v: B = None
        self.txt = txt

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

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

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

f.p = k
n.x = j
n.v = j
n.o = h
h.v = n
h.o = b
h.t = b
h.p = l
l.y = j
d.p = k
j.x = n
j.v = n
j.o = c
b.v = j
b.o = h
b.t = c
b.p = l
k.p = f
c.v = j
c.o = b
c.t = b
c.p = l
assert c.v.x.x.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.v: B = None
        self.txt = txt

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

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

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

f.p = k
n.x = j
n.v = j
n.o = h
h.v = n
h.o = b
h.t = b
h.p = l
l.y = j
d.p = k
j.x = n
j.v = n
j.o = c
b.v = j
b.o = h
b.t = c
b.p = l
k.p = f
c.v = j
c.o = b
c.t = b
c.p = l
assert c.v.x.x.o.t.txt == "b"