class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: E = None
        self.y: C = None
        self.p: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

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

a.w = g
a.y = g
a.t = h
a.p = l
n.w = l
g.t = l
f.t = c
h.p = l
h.z = g
h.y = g
h.s = c
c.r = l
c.t = f
c.x = h
l.r = c
l.t = f
l.x = h
assert n.w.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: E = None
        self.y: C = None
        self.p: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

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

a.w = g
a.y = g
a.t = h
a.p = l
n.w = l
g.t = l
f.t = c
h.p = l
h.z = g
h.y = g
h.s = c
c.r = l
c.t = f
c.x = h
l.r = c
l.t = f
l.x = h
assert n.w.x.y.txt == "g"