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: A = None
        self.t: A = None
        self.o: E = None
        self.y: F = None
        self.txt = txt

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

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

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

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

c = A("c")
d = B("d")
h = C("h")
a = D("a")
f = E("f")
i = F("i")
l = B("l")

c.v = h
c.w = l
d.p = c
d.t = c
d.o = f
d.y = i
h.w = c
h.o = a
a.v = d
a.w = d
a.z = i
f.q = c
f.p = h
f.x = h
i.o = f
i.x = c
i.s = h
l.p = c
l.t = c
l.o = f
l.y = i
assert l.y.x.w.o.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: A = None
        self.t: A = None
        self.o: E = None
        self.y: F = None
        self.txt = txt

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

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

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

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

c = A("c")
d = B("d")
h = C("h")
a = D("a")
f = E("f")
i = F("i")
l = B("l")

c.v = h
c.w = l
d.p = c
d.t = c
d.o = f
d.y = i
h.w = c
h.o = a
a.v = d
a.w = d
a.z = i
f.q = c
f.p = h
f.x = h
i.o = f
i.x = c
i.s = h
l.p = c
l.t = c
l.o = f
l.y = i
assert l.y.x.w.o.txt == "f"