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

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

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

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

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

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

i = A("i")
b = B("b")
h = C("h")
j = D("j")
k = E("k")
l = F("l")
g = B("g")

i.o = j
b.y = k
h.y = j
h.r = k
j.w = k
j.y = k
j.x = l
j.s = b
k.v = b
k.z = i
k.u = i
l.t = g
g.y = k
assert k.u.o.x.t.y.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

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

i = A("i")
b = B("b")
h = C("h")
j = D("j")
k = E("k")
l = F("l")
g = B("g")

i.o = j
b.y = k
h.y = j
h.r = k
j.w = k
j.y = k
j.x = l
j.s = b
k.v = b
k.z = i
k.u = i
l.t = g
g.y = k
assert k.u.o.x.t.y.u.o.txt == "j"