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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: D = None
        self.q: E = None
        self.t: A = None
        self.txt = txt

d = A("d")
e = B("e")
g = C("g")
l = D("l")
a = E("a")
c = F("c")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: D = None
        self.q: E = None
        self.t: A = None
        self.txt = txt

d = A("d")
e = B("e")
g = C("g")
l = D("l")
a = E("a")
c = F("c")

d.p = e
d.u = g
e.u = c
g.o = d
g.x = e
g.p = l
l.s = g
l.y = e
a.w = d
c.v = g
c.w = l
c.q = a
c.t = d
assert a.w.u.o.p.txt == "e"