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

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

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

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

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

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

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

d.p = l
h.w = e
h.s = g
h.z = c
c.s = e
e.u = l
e.q = g
e.t = c
e.x = c
g.s = c
g.x = l
g.v = h
l.p = c
l.v = g
assert h.w.u.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

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

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

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

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

d.p = l
h.w = e
h.s = g
h.z = c
c.s = e
e.u = l
e.q = g
e.t = c
e.x = c
g.s = c
g.x = l
g.v = h
l.p = c
l.v = g
assert h.w.u.p.s.txt == "e"