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

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

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

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

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

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

b = A("b")
f = B("f")
m = C("m")
h = D("h")
n = E("n")
d = F("d")
c = B("c")
l = D("l")

b.x = n
f.s = d
m.x = d
h.s = c
h.w = f
h.u = d
n.s = h
n.p = h
n.w = d
n.r = d
n.t = l
d.v = f
d.u = b
d.p = c
c.s = d
l.s = c
l.w = f
l.u = d
assert b.x.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

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

b = A("b")
f = B("f")
m = C("m")
h = D("h")
n = E("n")
d = F("d")
c = B("c")
l = D("l")

b.x = n
f.s = d
m.x = d
h.s = c
h.w = f
h.u = d
n.s = h
n.p = h
n.w = d
n.r = d
n.t = l
d.v = f
d.u = b
d.p = c
c.s = d
l.s = c
l.w = f
l.u = d
assert b.x.w.p.txt == "c"