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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: D = None
        self.z: B = None
        self.x: E = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: B = None
        self.t: D = None
        self.w: E = None
        self.txt = txt

l = A("l")
f = B("f")
c = C("c")
g = D("g")
e = E("e")
k = F("k")
d = D("d")
i = E("i")

l.v = f
l.p = c
f.v = c
f.u = c
f.p = d
c.z = l
c.o = f
g.x = d
g.p = l
e.r = f
e.z = f
e.y = g
e.x = i
e.v = c
k.r = g
k.t = g
k.q = f
k.w = i
d.x = g
d.p = l
i.r = f
i.z = f
i.y = g
i.x = e
i.v = c
assert k.t.p.p.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: D = None
        self.z: B = None
        self.x: E = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: B = None
        self.t: D = None
        self.w: E = None
        self.txt = txt

l = A("l")
f = B("f")
c = C("c")
g = D("g")
e = E("e")
k = F("k")
d = D("d")
i = E("i")

l.v = f
l.p = c
f.v = c
f.u = c
f.p = d
c.z = l
c.o = f
g.x = d
g.p = l
e.r = f
e.z = f
e.y = g
e.x = i
e.v = c
k.r = g
k.t = g
k.q = f
k.w = i
d.x = g
d.p = l
i.r = f
i.z = f
i.y = g
i.x = e
i.v = c
assert k.t.p.p.o.p.txt == "d"