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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: C = None
        self.p: D = None
        self.x: E = None
        self.t: E = None
        self.o: E = None
        self.txt = txt

b = A("b")
n = B("n")
c = C("c")
l = D("l")
g = E("g")
e = F("e")
a = E("a")
f = A("f")
h = A("h")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: C = None
        self.p: D = None
        self.x: E = None
        self.t: E = None
        self.o: E = None
        self.txt = txt

b = A("b")
n = B("n")
c = C("c")
l = D("l")
g = E("g")
e = F("e")
a = E("a")
f = A("f")
h = A("h")

b.v = c
b.w = n
n.p = l
c.p = l
c.w = n
l.w = e
l.y = f
l.s = g
g.q = a
g.u = c
e.z = h
e.s = c
e.p = l
e.x = g
e.t = a
e.o = a
a.q = g
a.u = c
f.v = c
f.w = n
h.v = c
h.w = n
assert g.u.w.p.s.u.w.p.txt == "l"