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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: A = None
        self.s: B = None
        self.r: D = None
        self.txt = txt

c = A("c")
m = B("m")
b = C("b")
e = D("e")
h = E("h")
d = F("d")
g = C("g")
i = D("i")

c.x = m
c.v = b
m.r = c
b.y = g
b.r = h
e.s = h
e.p = d
e.t = m
e.r = b
h.p = g
h.w = i
d.y = m
d.s = m
d.t = c
d.r = e
g.y = b
g.r = h
i.s = h
i.p = d
i.t = m
i.r = b
assert i.s.p.r.p.y.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: A = None
        self.s: B = None
        self.r: D = None
        self.txt = txt

c = A("c")
m = B("m")
b = C("b")
e = D("e")
h = E("h")
d = F("d")
g = C("g")
i = D("i")

c.x = m
c.v = b
m.r = c
b.y = g
b.r = h
e.s = h
e.p = d
e.t = m
e.r = b
h.p = g
h.w = i
d.y = m
d.s = m
d.t = c
d.r = e
g.y = b
g.r = h
i.s = h
i.p = d
i.t = m
i.r = b
assert i.s.p.r.p.y.r.w.txt == "i"